#ifndef _PACKET_H_
#define _PACKET_H_

#include <sys/neutrino.h>
#include <vector>

const int PACKET_AIRPORT_ADD 	 		= 1; 	/* dodanie nowego lotniska  */
const int PACKET_AIRPORT_DEL 			= 2; 	/* usuniecie lotniska z bazy danych */
const int PACKET_AIRPORTS_GET 		= 3; 	/* pobranie listy lotnisk */
const int PACKET_AIRPLANE_TYPE_GET 	= 4;	/* pobranie losowego typu dla nowo tworzonego samolotu */
const int PACKET_AIRPORT_COUNT		= 5; /*zapytanie o ilosc lotnisk */

const int DATABASE = 1;
const int AIRPORT    = 2;
const int AIRPLANE  = 3;
const int AI              = 4;
const int WEATHER  = 5;
const int GUI           = 10;

const int COMMAND_OK   = 255;

#define MAX_PLANES_IN_RANGE 50
#define MAX_RUNWAYS_IN_AIRPORT 10

// operations connected with GUI
#define GUI_WANT_AIRPORT_DATA 1
#define GUI_WANT_AIRCRAFT_DATA 2
#define GUI_WANT_RUNWAY_DATA 3
#define GUI_SEND_CONTROL_DATA 4

// operations connected with AI
#define AI_WANT_AIRPORT_DATA 1
#define AI_WANT_AIRCRAFT_DATA 2
#define AI_WANT_RUNWAY_DATA 3
#define AI_SEND_AIRCRAFT_DATA 4

// operations connected with AIRPORT
#define AIRPORT_WANT_PUT_ITS_DATA 1


typedef struct {
    char aircraftName[50];
    int aircraftID;
    int Xposition;
    int Yposition;
    int state;
    int FuelValue;
} samolot_t;

typedef struct {
	int samolot_typ_id;
	int zasieg_max;
	int bak_max; /* pojemnosc baku */
	int pasazerowie_max;
	int dlugosc_pasa; /* wymagana dlugosc pasa */
	int czas_startu;
	int czas_ladowania;
	int predkosc_max;
	char nazwa[50]; /* nazwa samolotu */
} samolot_typ_t;

typedef struct {
	int type;
    char airportName[50];
    int X;
    int Y;
    int Range;
    int Capacity;
    int RunwaysNumber;
    int State;
} lotnisko_t;

typedef struct
{
    int type; // type of message, maybe useful, maybe completely useless
    int noOfAircrafts; // how much aircrafts is in range and should be send to GUI
    samolot_t a[MAX_PLANES_IN_RANGE];
} aircraftList;

typedef struct
{
    int runwayID;
    bool isOccupied;
    char occupyName[20];
} runway;

typedef struct
{
    int noOfRunways;
    runway r[MAX_RUNWAYS_IN_AIRPORT];
} runwayList;


typedef struct{
	//struct _pulse hdr;
	int who;
	int type;
	union
	{
		lotnisko_t 		lotnisko;
		aircraftList		listaSamolotow;
		runwayList		listaPasow;
		samolot_t 		samolot;
		samolot_typ_t 	samolot_typ;
		
	};
		
} packet_t;


#endif
